package demo02;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/10/25 15:39
 */
public class Test02 {
    public static void main(String[] args) {
        Info<String> info1 = new Info<>();
        info1.setT("hello");
        fun(info1);

        Info<Integer> info2 = new Info<>();
        info2.setT(1);
        fun(info2);
    }

    public static void fun(Info<?> info){
        info.show();
    }
}

class Info<T>{
    private T t;

    public  void show(){
        System.out.println("泛型通配符...t="+t);
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    @Override
    public String toString() {
        return "Info{" +
                "t=" + t +
                '}';
    }
}